unit Main;

interface

uses
  Windows, Messages, SysUtils, Variants, Classes, Graphics, Controls, Forms,
  Dialogs, StdCtrls;

type
  TFormMain = class(TForm)
    Button1: TButton;
    Button2: TButton;
    Memo1: TMemo;
    Button3: TButton;
    Button4: TButton;
    Edit1: TEdit;
    Button5: TButton;
    Button6: TButton;
    Button7: TButton;
    Edit2: TEdit;
    procedure FormCreate(Sender: TObject);
    procedure Button1Click(Sender: TObject);
    procedure Button2Click(Sender: TObject);
    procedure Button3Click(Sender: TObject);
    procedure Button4Click(Sender: TObject);
    procedure Button5Click(Sender: TObject);
    procedure Button6Click(Sender: TObject);
    procedure Button7Click(Sender: TObject);
  private
    { Private declarations }
  public
    { Public declarations }
  end;

var
  FormMain: TFormMain;
const
  PASS_KEY : string ='_fly2ky_';
implementation
uses HelloWorldService,Des,fly2kyWebService2;
{$R *.dfm}

procedure TFormMain.FormCreate(Sender: TObject);
begin
  Memo1.Clear;  
end;

procedure TFormMain.Button1Click(Sender: TObject);
var
  sText : string;
  MyService : HelloWorldServicePortType;
begin
  MyService := GetHelloWorldServicePortType;
  try
    sText := MyService.getServerTime;
    Memo1.Lines.Add(sText);
  finally
    MyService := nil;
  end;

end;

procedure TFormMain.Button2Click(Sender: TObject);
var
  sText : string;
  MyService : HelloWorldServicePortType;
begin
  MyService := GetHelloWorldServicePortType;
  try
    sText := MyService.showGreetings('fly2ky');
    Memo1.Lines.Add(sText);
  finally
    MyService := nil;
  end;
end;

procedure TFormMain.Button3Click(Sender: TObject);
var
  sText : string;
  MyService : HelloWorldServicePortType;
begin
  MyService := GetHelloWorldServicePortType;
  try
    sText := MyService.getEncrypt(Edit1.Text,PASS_KEY);
    Edit1.Text := sText;
    Memo1.Lines.Add(sText);
  finally
    MyService := nil;
  end;

end;

procedure TFormMain.Button4Click(Sender: TObject);
var
  sText : string;
  MyService : HelloWorldServicePortType;
begin
  MyService := GetHelloWorldServicePortType;
  try
    sText := MyService.getDecrypt(Edit1.Text,PASS_KEY);
    Edit1.Text := sText;
    Memo1.Lines.Add(sText);
  finally
    MyService := nil;
  end;

end;

procedure TFormMain.Button5Click(Sender: TObject);
var
  sText : string;
begin
    sText := EncryStrHex(Edit1.Text,PASS_KEY);
    Edit1.Text := sText;
    Memo1.Lines.Add(sText);
end;

procedure TFormMain.Button6Click(Sender: TObject);
var
  sText : string;
begin
    sText := DecryStrHex(Edit1.Text,PASS_KEY);
    Edit1.Text := sText;
    Memo1.Lines.Add(sText);
end;

procedure TFormMain.Button7Click(Sender: TObject);
var
  sText : string;
  MyService : fly2kyWebServicePortType;
begin
  MyService := Getfly2kyWebServicePortType;
  try
    sText := MyService.login(Edit1.Text,Edit2.Text);
    Memo1.Lines.Add(sText);
  finally
    MyService := nil;
  end;
end;

end.
